export const useItemContainerCheckBox = () => {
  const checkAll = ref(false);
  const isIndeterminate = ref(false);
  const checkedCities = ref([]);
  const cities = [{
    id: '1',
    title: '甘肃省xxx设计项目A',
    circle: '2023/01/01—2023/04/01',
    auditDepartment: 'A省公司/A1部',
    doDepartment: 'A省公司/B2',
    person: '张嘉乐',
  },
  {
    id: '2',
    title: '甘肃省xxx设计项目A',
    circle: '2023/01/01—2023/04/01',
    auditDepartment: 'A省公司/A1部',
    doDepartment: 'A省公司/B2',
    person: '张嘉乐',
  }];

  const handleCheckAllChange = (val) => {
    checkedCities.value = val ? cities : [];
    isIndeterminate.value = false;
  };
  const handleCheckedCitiesChange = (value) => {
    const checkedCount = value.length;
    checkAll.value = checkedCount === cities.length;
    isIndeterminate.value = checkedCount > 0 && checkedCount < cities.length;
  };

  return {
    checkAll,
    isIndeterminate,
    checkedCities,
    cities,
    handleCheckAllChange,
    handleCheckedCitiesChange,
  };
};
